<template>
	<view class="newsDetails">
		<!-- 新闻详情 -->
		<view class="newsDetailsImg">
			<img :src="newsDetailsData.thumbUrl?newsDetailsData.thumbUrl:'/static/my/bag.jpg'" alt="" />
			<view class="newsDetailsTitle">
				{{newsDetailsData.title}}
			</view>
		</view>
		<view class="newsDetailsDiv">
			<u-parse :content="newsDetailsData.content"></u-parse>
		</view>
	</view>
</template>

<script>
	import {
		newsById
	} from '@/api/home.js'
	export default {
		data() {
			return {
				id: '',
				newsDetailsData: {}
			};
		},
		onLoad(e) {
			if (e.id) {
				this.id = e.id
			}
			this.getnewsDetailsData()
		},
		methods: {
			async getnewsDetailsData() {
				let res = await newsById(this.id)
				if (res.code == 200) {
					this.newsDetailsData = res.data
					console.log(res);
				}
			}
		}
	}
</script>

<style lang="scss">
	.newsDetails {
		.newsDetailsDiv {
			width: 100%;
			height: calc(100vh - 200rpx);
			background-color: #ffffff;
			border-radius: 40rpx 40rpx 0 0;
			margin-top: -100rpx;
			position: relative;
			z-index: 99;
			padding: 30rpx;
			overflow-y: auto;
		}

		.newsDetailsImg {
			width: 100%;
			height: 300rpx;
			position: relative;

			.newsDetailsTitle {
				position: absolute;
				left: 30rpx;
				bottom: 120rpx;
				font-size: 36rpx;
				font-weight: bold;
			}

			img {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>